代码/字面量创建.html
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //  使用class语法糖 创建对象  (自定义构造函数+原型组合方式)
        class Person {
            name = "李四"
            age = 20
            // new的时候触发，完成属性的初始化工作
            constructor(name, age) {
                this.name = name
                this.age = age
            }
            list() {
                console.log(this.name)
            }
        }
        var o1 = new Person('鲁班', 18)
        var o2 = new Person('韩信', 35)
        console.log(o1, o2)
        o1.list()
        o2.list()



    </script>
</body>

</html>